<?php 

class products_model extends CI_Model
{
	function __construct()
	{
		parent::__construct();	
	}
	
	function get_item_cat($catid,$num=10,$start=0)
	{
		$this->db->where('CategoryID',$catid);
		$this->db->order_by('Ordering','asc') ;
		$this->db->where('bl_active',1);
		return $this->db->get('product',$num,$start)->result();
	}
	
	function get_product($num=20,$offset=0)
	{
		$this->db->where('bl_active',1);
		$this->db->order_by('Ordering','DESC') ;
		return $this->db->get('product',$num,$offset)->result();
	}
	
	function get_num_product()
	{
		$this->db->where('bl_active',1);
		return $this->db->get('product')->num_rows();
	}
	
	function count_pro($catid)
	{
		$this->db->where('CategoryID',$catid);
		$this->db->where('bl_active',1);
		return $this->db->get('product')->num_rows();
	
	}

	function get_catid($catid,$num=10,$start=0)
	{
		$this->db->where('bl_active',1) ;
		$this->db->where('CategoryID',$catid) ;
		$this->db->order_by('Ordering','DESC') ;
		$query = $this->db->get('product', $num, $start) ;
		return $query->result() ;
	}
	
}
?>
